Skip to content

Conversation

@EdouardBougon
Copy link
Contributor

@EdouardBougon EdouardBougon commented Dec 3, 2025

Description

Open in GitHub Codespaces

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Adds Tron accountChanged notifications alongside Solana, unifies non‑EVM accountChanged emit, and updates UI/tests to recognize Tron Wallet Adapter; bumps related dependencies.

  • Controllers/Background:
    • Add Tron accountsChanged notifications on permission updates, selected account, and selected account group changes (_notifyTronAccountChange, new subscriptions).
    • Replace Solana‑only notifier with unified notifyNonEVMAccountChangedForCurrentAccount (handles Solana and Tron) and invoke on CAIP connection init.
  • UI:
    • Multichain connect page detects Tron Wallet Adapter requests (via TronAccountChangedNotifications) and includes default EVM+Tron networks.
  • Tests:
    • Add Tron selectedAccountGroupChange notification tests; extend connect page tests for Tron Wallet Adapter; update mocks for Tron scopes/methods and permissions utilities defaults.
  • Dependencies:
    • Bump @metamask/chain-agnostic-permission to ^1.3.0 and @metamask/multichain-api-middleware to ^1.2.5 (lockfile updated).

Written by Cursor Bugbot for commit 183e682. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-wallet-standard Team responsible of the MetaMask Wallet Standard implementation label Dec 3, 2025
@github-actions github-actions bot added the size-M label Dec 3, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [4bc9929]
UI Startup Metrics (1212 ± 95 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1212101015249512731391
load102084712808710651192
domContentLoaded101584312748610611184
domInteractive241585172179
firstPaint4118812733313441050
backgroundConnect21319325312222238
firstReactRender28185283048
getState3617139203991
initialActions107112
loadScripts807637105084851972
setupStore1173241220
numNetworkReqs1057016562
BrowserifyPower User HomeuiStartup20061627294724621792419
load1002864191016010341389
domContentLoaded989855189115810171367
domInteractive3016121212884
firstPaint6079619184189431324
backgroundConnect260190826129233584
firstReactRender53408395872
getState21014869789216300
initialActions103112
loadScripts78866416631538061154
setupStore1577081533
numNetworkReqs79641572275149
WebpackStandard HomeuiStartup8487201176868771040
load66258291875708825
domContentLoaded65857891475703818
domInteractive2616113202388
firstPaint21973795159199701
backgroundConnect12593131143
firstReactRender2920146173138
getState271360113447
initialActions104112
loadScripts65557691273701809
setupStore1163251221
numNetworkReqs1057316561
WebpackPower User HomeuiStartup15741226219024217732050
load674581100499699910
domContentLoaded66657599199691905
domInteractive32171232529109
firstPaint315103934208401682
backgroundConnect112768120231565
firstReactRender5744111106271
getState18113966556185227
initialActions105113
loadScripts66357398397688899
setupStore17861111544
numNetworkReqs80632603274149
FirefoxBrowserifyStandard HomeuiStartup13311073187115214321619
load109891614369911641270
domContentLoaded109791614369911631270
domInteractive62251933685146
firstPaint------
backgroundConnect47181402754115
firstReactRender23174652436
getState156196241125
initialActions103022
loadScripts107090114049311261231
setupStore12474111133
numNetworkReqs1256517661
BrowserifyPower User HomeuiStartup30761883530495241154773
load1359984267149213272547
domContentLoaded1359984267049113272547
domInteractive953035363103257
firstPaint------
backgroundConnect2452612103272991155
firstReactRender67371963188137
getState288881180235393795
initialActions2035322
loadScripts1215967246833012082298
setupStore135699822795745
numNetworkReqs75481342173123
WebpackStandard HomeuiStartup15231259225116916071902
load12511076169510813141466
domContentLoaded12511076169510813141465
domInteractive62282153682127
firstPaint------
backgroundConnect49172423257109
firstReactRender28207293040
getState157184231324
initialActions103122
loadScripts1223106216289712851388
setupStore15593161359
numNetworkReqs1256616763
WebpackPower User HomeuiStartup33072183705199341394972
load16691130496963822462798
domContentLoaded16691130496963822462797
domInteractive1842532143961421028
firstPaint------
backgroundConnect2192012432933091076
firstReactRender61382733560111
getState311801132270477829
initialActions401021423
loadScripts15641106490258215462637
setupStore1165121320498658
numNetworkReqs76531322272125
📊 Page Load Benchmark Results

Current Commit: 4bc9929 | Date: 12/3/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±40ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 720ms (±37ms) 🟢 | historical mean value: 723ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 76ms (±12ms) 🟢 | historical mean value: 78ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 40ms 1.01s 1.33s 1.06s 1.33s
domContentLoaded 720ms 37ms 697ms 1.00s 751ms 1.00s
firstPaint 76ms 12ms 56ms 180ms 84ms 180ms
firstContentfulPaint 76ms 12ms 56ms 180ms 84ms 180ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.95 KiB (0.06%)
  • ui: 0 Bytes (0%)
  • common: 20 Bytes (0%)

@metamaskbot
Copy link
Collaborator

Builds ready [fc1d5c0]
UI Startup Metrics (1258 ± 122 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12581015167212213431460
load1047854147210911171214
domContentLoaded1041849145810711091207
domInteractive261596192185
firstPaint54183147643010291226
backgroundConnect21619328116222252
firstReactRender312070103753
getState3716127204382
initialActions104113
loadScripts8326561205101898992
setupStore1263751326
numNetworkReqs271897211891
BrowserifyPower User HomeuiStartup20621751252916321382430
load1045907150213810431449
domContentLoaded1030898149413810281436
domInteractive36181462637115
firstPaint55714114744069901361
backgroundConnect25720960192236541
firstReactRender60411341764102
getState18913625625204239
initialActions104112
loadScripts81669512741378041217
setupStore21984102339
numNetworkReqs1556931755205256
WebpackStandard HomeuiStartup807692113470841924
load61956189258634740
domContentLoaded61455488858630734
domInteractive241496182083
firstPaint20678789141205613
backgroundConnect953741016
firstReactRender26203953136
getState24135193142
initialActions105111
loadScripts61255187957628726
setupStore1061931116
numNetworkReqs26986191881
WebpackPower User HomeuiStartup16811315245022018982050
load695600111097698930
domContentLoaded684594110597689916
domInteractive37181572936119
firstPaint276103935192264684
backgroundConnect107772720021604
firstReactRender624699106879
getState18113771457184221
initialActions103112
loadScripts682592109595687902
setupStore231165132553
numNetworkReqs1626939365217300
FirefoxBrowserifyStandard HomeuiStartup13391095184116114391638
load109091514049811461270
domContentLoaded108991514039811461270
domInteractive70312093690128
firstPaint------
backgroundConnect50241883265119
firstReactRender24186282337
getState1164461022
initialActions102012
loadScripts105789713699011131225
setupStore145247251036
numNetworkReqs281883192279
BrowserifyPower User HomeuiStartup25891970461547226633902
load1186989255423012321501
domContentLoaded1185989255423012321501
domInteractive1203245097113394
firstPaint------
backgroundConnect133341065153130382
firstReactRender58381351760102
getState29965932220423749
initialActions207123
loadScripts1147969253022111591466
setupStore16071023200167683
numNetworkReqs82581772580142
WebpackStandard HomeuiStartup15311320196112315931795
load1257109014938313131411
domContentLoaded1257108914938313121411
domInteractive69271593289132
firstPaint------
backgroundConnect47191522847125
firstReactRender28207492941
getState186175291461
initialActions103122
loadScripts1230107314637812881355
setupStore146143161535
numNetworkReqs281886192778
WebpackPower User HomeuiStartup29942040574587129154969
load14971120329548815232662
domContentLoaded14971120329548815232662
domInteractive113291061131108330
firstPaint------
backgroundConnect209271195263216968
firstReactRender66383114060166
getState270681014238262807
initialActions2031322
loadScripts14161105312840714662453
setupStore1455841204141665
numNetworkReqs82521542480139
📊 Page Load Benchmark Results

Current Commit: fc1d5c0 | Date: 12/5/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±52ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 733ms (±50ms) 🟢 | historical mean value: 724ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 79ms (±12ms) 🟢 | historical mean value: 79ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 52ms 1.01s 1.33s 1.09s 1.33s
domContentLoaded 733ms 50ms 700ms 1.01s 762ms 1.01s
firstPaint 79ms 12ms 64ms 180ms 88ms 180ms
firstContentfulPaint 79ms 12ms 64ms 180ms 88ms 180ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.95 KiB (0.06%)
  • ui: 0 Bytes (0%)
  • common: 20 Bytes (0%)

@socket-security
Copy link

socket-security bot commented Dec 5, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​metamask/​multichain-api-middleware@​1.2.4 ⏵ 1.2.5991007695100
Updated@​metamask/​chain-agnostic-permission@​1.2.2 ⏵ 1.3.0100 +11007895 +1100

View full report

@socket-security
Copy link

socket-security bot commented Dec 5, 2025

Caution

MetaMask internal reviewing guidelines:

  • Do not ignore-all
  • Each alert has instructions on how to review if you don't know what it means. If lost, ask your Security Liaison or the supply-chain group
  • Copy-paste ignore lines for specific packages or a group of one kind with a note on what research you did to deem it safe.
    @SocketSecurity ignore npm/PACKAGE@VERSION
Action Severity Alert  (click "▶" to expand/collapse)
Block Medium
Network access: npm @metamask/multichain-api-middleware in module globalThis["fetch"]

Module: globalThis["fetch"]

Location: Package overview

From: package.jsonnpm/@metamask/[email protected]

ℹ Read more on: This package | This alert | What is network access?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at [email protected].

Suggestion: Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@metamask/[email protected]. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@metamaskbot
Copy link
Collaborator

metamaskbot commented Dec 5, 2025

✨ Files requiring CODEOWNER review ✨

🔑 @MetaMask/accounts-engineers (2 files, +90 -6)
  • 📁 ui/
    • 📁 pages/
      • 📁 multichain-accounts/
        • 📁 multichain-accounts-connect-page/
          • 📄 multichain-accounts-connect-page.test.tsx +78 -0
          • 📄 multichain-accounts-connect-page.tsx +12 -6

@EdouardBougon EdouardBougon marked this pull request as ready for review December 5, 2025 17:36
@EdouardBougon EdouardBougon requested a review from a team as a code owner December 5, 2025 17:36
@EdouardBougon EdouardBougon requested a review from a team December 5, 2025 17:36
const tronScope =
sessionScopes[MultichainNetworks.TRON] ||
sessionScopes[MultichainNetworks.TRON_DEVNET] ||
sessionScopes[MultichainNetworks.TRON_TESTNET];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Non-existent enum values for Tron testnet networks

The code references MultichainNetworks.TRON_DEVNET and MultichainNetworks.TRON_TESTNET, but these enum values don't exist in the MultichainNetworks enum. The actual testnet values are TRON_NILE and TRON_SHASTA. This will cause tronScope to be undefined for any Tron testnet sessions, preventing account change notifications from being sent for testnet connections. Other parts of the same codebase correctly use TRON_SHASTA and TRON_NILE.

Fix in Cursor Fix in Web

} from '@metamask/seedless-onboarding-controller';
import { PRODUCT_TYPES } from '@metamask/subscription-controller';
import { isSnapId } from '@metamask/snaps-utils';
import { address } from '@solana/addresses';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Unused and misplaced Solana address import

The address function is imported from @solana/addresses but never used in this file. All other occurrences of address in the file are object destructuring from parseCaipAccountId(), not calls to this imported function. This appears to be accidentally committed debug code or a copy-paste error.

Fix in Cursor Fix in Web

`${this.accountsController.name}:selectedAccountChange`,
async (account) => {
if (
account.type === TrxAccountType.Eoa &&
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Tron types used outside conditional compilation guard

The code uses TrxAccountType.Eoa and TrxScope.Mainnet outside any conditional compilation block, but these types are imported within ///: BEGIN:ONLY_INCLUDE_IF(tron) guards (lines 66-69). When the tron feature flag is disabled, these identifiers will be undefined, causing runtime errors when comparing account.type === TrxAccountType.Eoa or calling getAccountsFromSelectedAccountGroup with scopes: [TrxScope.Mainnet]. The new Tron subscription code needs to be wrapped in the same conditional blocks.

Additional Locations (2)

Fix in Cursor Fix in Web

@EdouardBougon EdouardBougon marked this pull request as draft December 5, 2025 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-L team-wallet-standard Team responsible of the MetaMask Wallet Standard implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants